﻿<Window x:Class="DaisleyHarrison.WPF.ComplexDataTemplates.UnitTest.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:DaisleyHarrison.WPF.ComplexDataTemplates.UnitTest"
    xmlns:complex="clr-namespace:DaisleyHarrison.WPF.ComplexDataTemplates;assembly=ComplexDataTemplates"
    Title="ComplexDataTemplates UnitTest" Height="506" Width="389">
    <Window.Resources>
        <complex:ComplexGroupDataTemplateSelector x:Key="complex-group-data-template-selector"/>
        <complex:ComplexGroupConverter x:Key="complex-group-converter"/>
        <HierarchicalDataTemplate DataType="{x:Type local:ClassA}">
            <HierarchicalDataTemplate.ItemsSource>
                <MultiBinding Converter="{StaticResource complex-group-converter}">
                    <Binding Path="ListOfClassB"/>
                    <Binding Path="ListOfClassC"/>
                </MultiBinding>
            </HierarchicalDataTemplate.ItemsSource>
            <StackPanel Orientation="Horizontal">
                <Image Source="Images/ClassA.png" VerticalAlignment="Center"  Margin="0,5,0,5"/>
                <TextBlock Text="{Binding Path=Label}" ToolTip="{Binding Path=ToolTip}" VerticalAlignment="Center"  Margin="5,0,0,0"/>
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="IEnumerable[ClassB]" ItemsSource="{Binding Path=.}">
            <StackPanel Orientation="Horizontal">
                <Image Source="Images/classBs.png" VerticalAlignment="Center"  Margin="0,5,0,5"/>
                <TextBlock VerticalAlignment="Center"  Margin="5,0,0,0">List of Class Bs</TextBlock>
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="IEnumerable[ClassC]" ItemsSource="{Binding Path=.}">
            <StackPanel Orientation="Horizontal">
                <Image Source="Images/classCs.png" VerticalAlignment="Center"  Margin="0,5,0,5"/>
                <TextBlock VerticalAlignment="Center"  Margin="5,0,0,0">List of Class Cs</TextBlock>
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="IEnumerable[Item]" ItemsSource="{Binding Path=.}">
            <TextBlock>List of Items</TextBlock>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="Pickles-Template" ItemsSource="{Binding Path=.}">
            <StackPanel Orientation="Horizontal">
                <Image Source="Images/pickle.png" VerticalAlignment="Center"  Margin="0,5,0,5"/>
                <TextBlock VerticalAlignment="Center"  Margin="5,0,0,0">Pickles</TextBlock>
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="IceCream-Template" ItemsSource="{Binding Path=.}">
            <StackPanel Orientation="Horizontal">
                <Image Source="Images/icecream.png" VerticalAlignment="Center"  Margin="0,5,0,5"/>
                <TextBlock VerticalAlignment="Center"  Margin="5,0,0,0">Ice Cream</TextBlock>
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate DataType="{x:Type local:ClassB}">
            <StackPanel Orientation="Horizontal">
                <Image Source="Images/classB.png" VerticalAlignment="Center" Margin="0,5,0,5"/>
                <TextBlock  VerticalAlignment="Center"  Margin="5,0,0,0">Class B:</TextBlock>
                <TextBlock Text="{Binding Path=Label}" ToolTip="{Binding Path=ToolTip}" VerticalAlignment="Center"  Margin="5,0,0,0"/>
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate DataType="{x:Type local:ClassC}">
            <HierarchicalDataTemplate.ItemsSource>
                <MultiBinding Converter="{StaticResource complex-group-converter}" ConverterParameter="Pickles-Template,IceCream-Template">
                    <Binding Path="Pickles"/>
                    <Binding Path="IceCream"/>
                </MultiBinding>
            </HierarchicalDataTemplate.ItemsSource>
            <StackPanel Orientation="Horizontal">
                <Image Source="Images/classC.png" VerticalAlignment="Center" Margin="0,5,0,5"/>
                <TextBlock  VerticalAlignment="Center"  Margin="5,0,0,0">Class C:</TextBlock>
                <TextBlock Text="{Binding Path=Label}" ToolTip="{Binding Path=ToolTip}"  VerticalAlignment="Center"  Margin="5,0,0,0"/>
            </StackPanel>
        </HierarchicalDataTemplate>
        <DataTemplate DataType="{x:Type local:IItem}">
            <StackPanel Orientation="Horizontal">
                <Image Source="Images/item.png" VerticalAlignment="Center" Margin="0,5,0,5"/>
                <TextBlock VerticalAlignment="Center" Margin="5,0,0,0">Item:</TextBlock>
                <TextBlock Text="{Binding Path=Label}" ToolTip="{Binding Path=ToolTip}" VerticalAlignment="Center" Margin="5,0,0,0"/>
            </StackPanel>
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <TreeView x:Name="textTreeView" ItemTemplateSelector="{StaticResource complex-group-data-template-selector}">
            
        </TreeView>
    </Grid>
</Window>
